package cn.online.taxi.common.test;

import java.util.Scanner;

class Data {
    private String[] dataItems;
    private int dataCount;
    private int n = 5;

    public Data() {
        this.dataItems = new String[n];
        this.dataCount = 0;
        this.n = n;
    }
    public boolean push(String item) {
        if (dataCount == n)
            return false;
        dataItems[dataCount] = item;
        ++dataCount;
        return true;
    }

    public String pop() {
        if (dataCount == 0)
            return null;
        String temp = dataItems[dataCount - 1];
        --dataCount;
        return temp;
    }
}

class Symbol {
    private String[] symbolItems;
    private int symbolCount;
    private int n = 5;

    public Symbol() {
        this.symbolItems = new String[n];
        this.symbolCount = 0;
        this.n = n;
    }
    public boolean push(String item) {
        if (symbolCount == n)
            return false;
        symbolItems[symbolCount] = item;
        ++symbolCount;
        return true;
    }

    public String pop() {
        if (symbolCount == 0)
            return null;
        int pointer = symbolCount - 1;  // 栈指针
        String temp = symbolItems[pointer];
        --symbolCount;
        return temp;
    }
}

public class Stack {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        Data data = new Data();
        Symbol symbol = new Symbol();
        while(true) {
            char item = sc.next().charAt(0);
            int itemAscii = Integer.valueOf(item).intValue();
            if (itemAscii == 61)
                break;
            if(itemAscii >= 49 && itemAscii <= 57) {
                data.push(String.valueOf((char) itemAscii));
            }
            if(itemAscii == 42 || itemAscii == 43 || itemAscii == 45 || itemAscii == 47) {
                symbol.push(String.valueOf((char) itemAscii));
            }
        }


        sc.close();
    }
}
